<template>
  <!-- <div>电影</div> -->
  <FilmListTopNav :class="fixed ? 'fixed' : ''" />
  <router-view></router-view>
</template>

<script setup lang="ts">
import { onMounted, ref } from "vue";
import FilmListTopNav from "../components/FilmListTopNav.vue";
let fixed = ref<boolean>(false);
onMounted(() => {
  window.addEventListener(
    "scroll",
    () => {
      let top = document.documentElement.scrollTop;
      if (top > 50) {
        // 吸顶
        fixed.value = true;
        // console.log(12121);
        
      } else {
        // 还原
        fixed.value = false;
      }
    },
    true
  );
})
</script>
<style lang="scss" scoped>
.fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
</style>
